<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.jsdelivr.net/npm/echarts@4.7.0/dist/echarts.min.js"></script>
  <title>Document</title>
  <style>
    #chart { 
      width: 800px;
      height: 400px;
    }
  </style>
</head>
<body>
  <div id="chart"></div>
  <script>
    const chartDom = document.getElementById('chart');
    const chart = echarts.init(chartDom);
    const option = {
      dataset: {
        source: [
          ['一季度', 100, 79, '分类1', 50],
          ['二季度', 112, 81, '分类2', 60],
          ['三季度', 96, 88, '分类3', 55],
          ['四季度', 123, 72, '分类4', 70],
        ]
      },
      title: {
        text: 'Echatrs 多系列案例',
        subtext:'慕课网数据可视化课程'
      },
      xAxis: {
        // data: ['一季度', '二季度', '三季度', '四季度']
        type: 'category'
      },
      yAxis: {},
      legend: {
        data: [{
          name: '分类',
          // 强制设置图形为圆。
          icon: 'circle',
          // 设置文本为红色
          textStyle: {
            color: 'red'
          }
        }, '折线图', '柱状图'],
        left: 100
      },
      toolbox: {
        feature: {
          dataZoom: {
            yAxisIndex: 'none'
          },
          restore: {},
          saveAsImage: {}
        }
      },
      dataZoom: [{
        show: true,
        start: 0,
        end: 100
      }],
      grid: [{
        left: 50,
        top: 70
      }],
      series: [{
        type: 'pie',
        center: ['65%', 60],
        radius: 35,
        // data: [{
        //   name: '分类1', value: 50
        // }, {
        //   name: '分类2', value: 60
        // }, {
        //   name: '分类3', value: 55
        // }, {
        //   name: '分类4', value: 70
        // }]
        encode:{ itemName: 3, value: 4}
      }, {
        type: 'line',
        // data: [100, 112, 96, 123]
        encode: {x:0, y:1}
      }, {
        type: 'bar',
        // data: [79, 81, 88, 72]
        encode: {x:0, y:2}
      }]
    }
    chart.setOption(option);
  </script>
</body>
</html>